<?php view('_header', array('title' => $title)) ?>

<script src="public/js/jquery.ui.core.js"></script>
<script src="public/js/jquery.ui.widget.js"></script>
<script src="public/js/jquery.ui.mouse.js"></script>
<script src="public/js/jquery.ui.draggable.js"></script>
<script src="public/js/jquery.ui.droppable.js"></script>
<script src="public/js/jquery.ui.sortable.js"></script>
<script src="public/js/jquery.ui.accordion.js"></script>
<script src="public/js/jquery.bgiframe-2.1.2.js"></script>
<script src="public/js/jquery.ui.button.js"></script>
<script src="public/js/jquery.ui.position.js"></script>
<script src="public/js/jquery.ui.resizable.js"></script>
<script src="public/js/jquery.ui.dialog.js"></script>
<script src="public/js/jquery.effects.core.js"></script>
<script src="public/js/jquery.ui.datepicker.js"></script>
<script src="public/js/jquery.dock.js"></script>

<style>
	h1 { padding: .2em; margin: 0; font-size: 12px;}
	#renyuan { float:left; width: 200px; margin-right: 2em; }
	#fuzeren { width: 200px; float: left; }
	#fuzeren ol { margin: 0; padding: 1em 0 1em 3em; }

	label, input { display:block; }
	input.text { margin-bottom:12px; width:95%; padding: .4em; }
	fieldset { padding:0; border:0; margin-top:25px; }
	div#users-contain { width: 800px; margin: 20px 0; }
	div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
	div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
	.ui-dialog .ui-state-error { padding: .3em; }
	.validateTips { border: 1px solid transparent; padding: 0.3em; }
</style>
<script>
	$(function() {
		$( "#catalog" ).accordion();
		$( "#catalog li" ).draggable({
			appendTo: "body",
			helper: "clone"
		});
		$( "#gai1" ).droppable({
			activeClass: "ui-state-default",
			hoverClass: "ui-state-hover",
			accept: ":not(.ui-sortable-helper)",		
			drop: function( event, ui ) {
				var inid =  $(this).parents().attr("id");
				var infd = $(this).attr("fd");
				var editval =ui.draggable.text();
				var placeholder=document.getElementById("placeholder1");
				placeholder.style.display='none';
				$("<a id='placeholder1'></a>").text( editval ).appendTo( this );
				$.post("index.php?c=pj&a=edit",{id:inid,fd:infd,val:editval});
			}
		});
		$( "#gai2" ).droppable({
			activeClass: "ui-state-default",
			hoverClass: "ui-state-hover",
			accept: ":not(.ui-sortable-helper)",		
			drop: function( event, ui ) {
				var inid =  $(this).parents().attr("id");
				var infd = $(this).attr("fd");
				var editval =ui.draggable.text();
				var placeholder=document.getElementById("placeholder2");
				placeholder.style.display='none';
				$("<a id='placeholder2'></a>").text( editval ).appendTo( this );
				$.post("index.php?c=pj&a=edit",{id:inid,fd:infd,val:editval});
			}
		});
		$( "#gai3" ).droppable({
			activeClass: "ui-state-default",
			hoverClass: "ui-state-hover",
			accept: ":not(.ui-sortable-helper)",		
			drop: function( event, ui ) {
				var inid =  $(this).parents().attr("id");
				var infd = $(this).attr("fd");
				var editval =ui.draggable.text();
				var placeholder=document.getElementById("placeholder3");
				placeholder.style.display='none';
				$("<a id='placeholder3'></a>").text( editval ).appendTo( this );
				$.post("index.php?c=pj&a=edit",{id:inid,fd:infd,val:editval});
			}
		});
		$( "#gai4" ).droppable({
			activeClass: "ui-state-default",
			hoverClass: "ui-state-hover",
			accept: ":not(.ui-sortable-helper)",		
			drop: function( event, ui ) {
				var inid =  $(this).parents().attr("id");
				var infd = $(this).attr("fd");
				var editval =ui.draggable.text();
				var placeholder=document.getElementById("placeholder4");
				placeholder.style.display='none';
				$("<a id='placeholder4'></a>").text( editval ).appendTo( this );
				$.post("index.php?c=pj&a=edit",{id:inid,fd:infd,val:editval});
			}
		});
		$( "#gai5" ).droppable({
			activeClass: "ui-state-default",
			hoverClass: "ui-state-hover",
			accept: ":not(.ui-sortable-helper)",		
			drop: function( event, ui ) {
				var inid =  $(this).parents().attr("id");
				var infd = $(this).attr("fd");
				var editval =ui.draggable.text();
				var placeholder=document.getElementById("placeholder5");
				placeholder.style.display='none';
				$("<a id='placeholder5'></a>").text( editval ).appendTo( this );
				$.post("index.php?c=pj&a=edit",{id:inid,fd:infd,val:editval});
			}
		});
	});
	

	
	
	$(function() {

		$( "#datepicker1" ).datepicker({  
			dateFormat: 'yy-mm-dd',
			onSelect:function(){
				var infd =  $(this).parents().attr("fd");
				var inid = $(this).parents().parents().attr("id");
				var pressDate=$("#datepicker1").val();
				$.post("index.php?c=pj&a=edit",{id:inid,fd:infd,val:pressDate});			
			}
		});
		$( "#datepicker2" ).datepicker({  
			dateFormat: 'yy-mm-dd',
			onSelect:function(){
				var infd =  $(this).parents().attr("fd");
				var inid = $(this).parents().parents().attr("id");
				var pressDate=$("#datepicker2").val();
				$.post("index.php?c=pj&a=edit",{id:inid,fd:infd,val:pressDate});			
			}
		});
	});
	
	
	
	
	$(function(){//POST project
		$("#po").dblclick(function(){
			var inval = $(this).html();
			var infd = $(this).attr("fd");
			var inid =  $(this).parents().attr("id");
			$(this).html("<input id='edit"+infd+inid+"' value='"+inval+"'> ");

			$("#edit"+infd+inid).focus().live("blur",function(){
				var editval = $(this).val();
				$(this).parents("td").html(editval);
				$.post("index.php?c=pj&a=edit",{id:inid,fd:infd,val:editval});
			})
		});
	})
</script>
</head>
<body>

			<div>
				<div id="" class="">

					<table id="users" class="" style="width: 850px;">
						<thead>
							<tr class="">
								<th>编号</th>
								<th>项目</th>
								<th>负责人</th>
								<th>PHP</th>
								<th>AS</th>
								<th>美术</th>
								<th>测试</th>
								<th>送测时间</th>
								<th>上线时间</th>
							</tr>
						</thead>
						<tbody>
							<?php
							for ($i = 0; $i < count($content); $i++)
							{
								?>
								<tr id="<?php echo $content[$i]->pid; ?>">

									<td fd="pp"><?php echo $content[$i]->pt . "-" . $content[$i]->code; ?></td>
									<td id="po" fd="project"><?php echo $content[$i]->project; ?></td>			
									<td id="gai1" fd="master"><a id="placeholder1"><?php echo $content[$i]->master; ?></a></td>			
									<td id="gai2" fd="php"><a id="placeholder2"><?php echo $content[$i]->php; ?></a></td>
									<td id="gai3" fd="as"><a id="placeholder3"><?php echo $content[$i]->as; ?></a></td>
									<td id="gai4" fd="design"><a id="placeholder4"><?php echo $content[$i]->design; ?></a></td>
									<td id="gai5" fd="test"><a id="placeholder5"><?php echo $content[$i]->test; ?></a></td>
									<td fd="starttime"><input id="datepicker1" type="text" size="10"  value="<?php echo date('Y-m-d', strtotime($content[$i]->starttime)); ?>"/></td>
									<td fd="endtime"><input id="datepicker2" type="text" size="10"  value="<?php echo date('Y-m-d', strtotime($content[$i]->endtime)); ?>"/></td>
			<!--							<input type="text" id="datepicker2"  value="<?php echo $content[$i]->endtime; ?>"/>-->

								</tr>
							<?php } ?>
						</tbody>
					</table>
				</div>


			</div><!-- End demo -->
			
			
			
						<div class="project">

				<div id="renyuan">
					<!--<h1 class="ui-widget-header">人员</h1>-->
					<div id="catalog">
						<h3><a href="#">product</a></h3>
						<div>
							<ul>
								<?php for ($i = 0; $i < count($content_user1); $i++)
								{ ?>
									<li><?php echo $content_user1[$i]->username; ?></li>
								<?php } ?>
							</ul>
						</div>
						<h3><a href="#">PHP</a></h3>
						<div>
							<ul>
								<?php for ($i = 0; $i < count($content_user2); $i++)
								{ ?>
									<li><?php echo $content_user2[$i]->username; ?></li>
								<?php } ?>
							</ul>
						</div>
						<h3><a href="#">AS</a></h3>
						<div>
							<ul>
								<?php for ($i = 0; $i < count($content_user3); $i++)
								{ ?>
									<li><?php echo $content_user3[$i]->username; ?></li>
								<?php } ?>
							</ul>
						</div>
						<h3><a href="#">test</a></h3>
						<div>
							<ul>
								<?php for ($i = 0; $i < count($content_user4); $i++)
								{ ?>
									<li><?php echo $content_user4[$i]->username; ?></li>
								<?php } ?>
							</ul>
						</div>
						<h3><a href="#">design</a></h3>
						<div>
							<ul>
								<?php for ($i = 0; $i < count($content_user5); $i++)
								{ ?>
									<li><?php echo $content_user5[$i]->username; ?></li>
								<?php } ?>
							</ul>
						</div>
					</div>
				</div>
			</div><!-- End demo -->
